home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
xmm12.zip
/
XMM.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-07-05
|
45KB
|
927 lines
{--------------------------------------------------------------------------
UNIT : XMM INITIAL : 19891127 v 1.00
AUTHOR : Jeroen W. Pluimers UPDATE : 19920705 v 1.20
DESCRIPTION : eXpanded Memory Manager
HISTORY : 19891127 - 1.00 - jwp
initial translation from XMS 2.0 specification
19909322 - 1.11 - jwp
final XMS 2.0 implementation
19920705 - 1.20 - jwp
incorporation of XMS 3.0 specification
COMPUTER : NEAT-AT, ERC 386/25
COMPILER : TURBO PASCAL 5.0, 5.5 and 6.0
COPYRIGHT : (c) 1989-1992 Pluimers Software Ontwikkeling.
--------------------------------------------------------------------------}
Unit XMM;
{$I Directive.Inc }
Interface
Type
XMMMoveRec = Record Case Boolean of
False : (Length : Longint; { 32-bit number of bytes to transfer }
SourceHandle : Word; { Handle of source block }
SourceOffset : Longint; { 32-bit offset into source }
DestHandle : Word; { Handle of destination block }
DestOffset : Longint; { 32-bit offset into destination block }
);
True : (TheLenght : Longint; { note that the lenght must be even ! }
ZeroSource : Word; { zero sourcehandle means a seg:ofs }
SourcePtr : Pointer; { pointer to "normal" memory }
ZeroDest : Word; { zero dest handle means a seg:ofs }
DestPtr : Pointer; { pointer to "normal" memory }
);
End; { XMMMoveRec }
Const
XMMOk = $00;{ function succeeded. }
XMMNotImplemented = $80;{ the function is not implemented. }
XMMVDiskFound = $81;{ a VDISK device is detected. }
XMMA20Err = $82;{ an A20 error occurs. }
XMMGenErr = $8E;{ a general driver error occurs. }
XMMUnrecovErr = $8F;{ an unrecoverable driver error occurs. }
XMMHMAnotExist = $90;{ the HMA does not exist. }
XMMHMAInUse = $91;{ the HMA is already in use. }
XMMHMAminSize = $92;{ DX is less than the /HMAMIN= parameter. }
XMMHMANotAlloced = $93;{ the HMA is not allocated. }
XMMA20StillEnabled = $94;{ the A20 line is still enabled. }
XMMOutOfMemory = $A0;{ all extended memory is allocated. }
XMMOutOfHandles = $A1;{ all available extended memory handles are in use.}
XMMInvalidHandle = $A2;{ the handle is invalid. }
XMMSourceHanldeInv = $A3;{ the SourceHandle is invalid. }
XMMSourceOffsetInv = $A4;{ the SourceOffset is invalid. }
XMMDestHanleInv = $A5;{ the DestHandle is invalid. }
XMMDestOffset = $A6;{ the DestOffset is invalid. }
XMMLenInv = $A7;{ the Length is invalid. }
XMMOverlap = $A8;{ the move has an invalid overlap. }
XMMParity = $A9;{ a parity error occurs. }
XMMEMBUnlocked = $AA;{ the block is not locked. }
XMMEMBLocked = $AB;{ the block is locked. }
XMMLockOverflow = $AC;{ the block's lock count overflows. }
XMMLockFail = $AD;{ the lock fails. }
Function XMMInstalled : Boolean;
{---------------------------------------------------------------------------
ROUTINE : XMMInstalled
DESCRIPTION : THIS ROUTINE MUST BE CALLED BEFORE ANY OTHER ROUTINE
OR ALL THE OTHER ROUTINES WILL FAIL WITH ERROR CODE $80.
RETURNS : False - No XMM driver found.
True - An XMM driver has been found.
POST : Internal pointer to XMM driver is established.
---------------------------------------------------------------------------}
Function XMMVersion(Var XMSversion,
XMSrevision : Word;
Var HMAAvailable : Boolean) : Byte;
{---------------------------------------------------------------------------
ROUTINE : XMMVersion
DESCRIPTION : Get version numbers. Both the XMS version number and the
driver internal revision number are encoded as follows :
Low byte = minor part.
High byte = major part.
e.g. XMSversion $0277 would mean version 2.77.
The HMAAvailable indicates the existence of the HMA (not
its availability) and is intended mainly for installation
programs.
OUT : XMSversion - XMS version number.
XMSrevision - Driver internal revision number.
HMAAvailable - False - no HMA detected.
True - HMA has been detected.
RETURNS : XMMOk - Always if XMMInstalled has been called.
XMMNotImplemented - XMMInstalled has not been called.
PRE : XMMInstalled must have been called first.
---------------------------------------------------------------------------}
Function XMMRequestHMA (SpaceNeeded : Word) : Byte;
{---------------------------------------------------------------------------
ROUTINE : XMMRequestHMA
DESCRIPTION : Attempts to reserve the whole 64K-16 byte high memory
area for the caller.
If the HMA is currently unused, the caller's size
parameter is compared to the /HMAMIN= parameter on
the driver's command line.
If the value passed by the caller is greater than or
equal to the amount specified by the driver's
parameter, the request succeeds.
This provides the ability to ensure that programs
which use the HMA efficiently have priority over
those which do not.
NOTE: See the sections "Prioritizing HMA Usage" and
"High Memory Area Restrictions" in the
documentation for more information.
IN : SpaceNeeded - Number of bytes in the HMA needed by caller.
It is recommended that if the caller is
an application program this value is
set to 65535 and if the caller is a TSR
the real number of bytes is used.
RETURNS : XMMOk - the HMA is assigned to the caller.
XMMNotImplemented - the function is not implemented.
XMMVDiskFound - a VDISK device is detected.
XMMHMANotExist - the HMA does not exist.
XMMHAMInUse - the HMA is already in use.
XMMHAMMinSize - SpaceNeeded is less than the /HMAMIN=
environment parameter.
PRE : XMMInstalled must have been called first.
---------------------------------------------------------------------------}
Function XMMReleaseHMA : Byte;
{---------------------------------------------------------------------------
ROUTINE : XMMReleaseHMA
DESCRIPTION : Releases the high memory area and allows other
programs to use it.
Programs which allocate the HMA must release it
before exiting.
When the HMA has been released,